home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / addhead.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  90 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: addhead.c,v 1.7 1996/10/24 15:50:41 aros Exp $
  4.     $Log: addhead.c,v $
  5.     Revision 1.7  1996/10/24 15:50:41  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.6  1996/10/21 20:46:11  aros
  9.     Changed struct SysBase to struct ExecBase
  10.  
  11.     Revision 1.5  1996/08/13 13:55:55  digulla
  12.     Replaced AROS_LA by AROS_LHA
  13.     Replaced some AROS_LH*I by AROS_LH*
  14.     Sorted and added includes
  15.  
  16.     Revision 1.4  1996/08/01 17:41:01  digulla
  17.     Added standard header for all files
  18.  
  19.     Desc:
  20.     Lang: english
  21. */
  22. #include "exec_intern.h"
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <exec/lists.h>
  28.     #include <clib/exec_protos.h>
  29.  
  30.     AROS_LH2I(void, AddHead,
  31.  
  32. /*  SYNOPSIS */
  33.     AROS_LHA(struct List *, list, A0),
  34.     AROS_LHA(struct Node *, node, A1),
  35.  
  36. /*  LOCATION */
  37.     struct ExecBase *, SysBase, 40, Exec)
  38.  
  39. /*  FUNCTION
  40.     Insert Node node as the first node of the list.
  41.  
  42.     INPUTS
  43.     list - The list to insert the node into
  44.     node - This node is to be inserted
  45.  
  46.     RESULT
  47.  
  48.     NOTES
  49.  
  50.     EXAMPLE
  51.     struct List * list;
  52.     struct Node * pred;
  53.  
  54.     // Insert Node at top
  55.     AddHead (list, node);
  56.  
  57.     BUGS
  58.  
  59.     SEE ALSO
  60.  
  61.     INTERNALS
  62.  
  63.     HISTORY
  64.     26-08-95    digulla created after EXEC-Routine
  65.     26-10-95    digulla adjusted to new calling scheme
  66.  
  67. ******************************************************************************/
  68. {
  69.     AROS_LIBFUNC_INIT
  70.     assert (node);
  71.     assert (list);
  72.  
  73.     /*
  74.     Make the node point to the old first node in the list and to the
  75.     head of the list.
  76.     */
  77.     node->ln_Succ       = list->lh_Head;
  78.     node->ln_Pred       = (struct Node *)&list->lh_Head;
  79.  
  80.     /*
  81.     New we come before the old first node which must now point to us
  82.     and the same applies to the pointer to-the-first-node in the
  83.     head of the list.
  84.     */
  85.     list->lh_Head->ln_Pred = node;
  86.     list->lh_Head       = node;
  87.     AROS_LIBFUNC_EXIT
  88. } /* AddHead */
  89.  
  90.